import React, { Component } from 'react';
import '../../style/Index/Miaosha.css'
import services from '../../api/interface'
import { withRouter } from 'react-router-dom';
class Miaosha extends Component {
  state = {
    miaolist: []
  }
  async componentDidMount() {
    var res = await services.pro.pro_seckilllist()
    this.setState({
      miaolist: res.data.data
    })
    // console.log(res.data.data);
  }
  onClickk(item){
    this.props.history.push({pathname:'/detail',state:{id:item.proid}})
  }
  render() {
    return (
      <div className="Miaosha">
        <div className="topp">
          <div className="miaoshain">
            <div className="left">
              <p>嗨购秒杀&emsp;<span>8 点场</span></p>
            </div>
            <div className="right">
              <span>爆款轮番秒</span>
              <div className="circle">&gt;</div>
            </div>
          </div>
        </div>
        <div className="bottom">
          <div className="shuju">
            {
              this.state.miaolist.map((item, index) => {
                return (
                  <div className="shujubox" key={index} onClick={()=>{this.onClickk(item)}}>
                    <img src={item.img1} alt="" />
                    <div className="text" >
                      ￥{item.originprice}
                    </div>
                  </div>
                )
              })
            }
          </div>
        </div>
      </div>
    )
  }
}

export default withRouter(Miaosha);